require(['../config'], () => {
    require(['template', 'header', 'footer'], (template) => {
        class register {
            constructor() {
                this.init()
            }
            init() {
                $('#regBtn').on('click', (e) => {
                    e.preventDefault()
                    const name = $('#inputUsrname').val()
                    const pwd = $('#inputPwd').val()
                    $.get('http://localhost/php/register.php', { name, pwd }, resp => {
                        if (resp == 200) {
                            alert("注册成功，将会跳转登录界面")
                            location.href = "/html/modules/login.html"
                        } else {
                            alert("网络异常，请重新注册")
                        }
                    })
                })
            }

        }
        new register()
    })
})